#pragma once

//#include <rtl/base.h>

#define READ8(a) *((volatile UINT8 *)(a))
#define WRITE8(a, v) *((volatile UINT8 *)(a)) = v

#define READ16(a) *((volatile UINT16 *)(a))
#define WRITE16(a, v) *((volatile UINT16 *)(a)) = v

#define READ32(a) *((volatile UINT32 *)(a))
#define WRITE32(a, v) *((volatile UINT32 *)(a)) = v

#define IO_PHYS 0x10000000
#define U3D_BASE (IO_PHYS + 0x01270000)
//#define U3D_EP_RST (SSUSB_EPCTL_CSR_BASE + 0x0004)

#define USB_SIF_BASE (IO_PHYS + 0x01280000)
#define USB_SIF2_BASE (IO_PHYS + 0x01290000)

#define SSUSB_DEV_BASE (U3D_BASE + 0x1000)
#define SSUSB_EPCTL_CSR_BASE (U3D_BASE + 0x1800)
#define SSUSB_USB3_MAC_CSR_BASE (U3D_BASE + 0x2400)
#define SSUSB_USB3_SYS_CSR_BASE (U3D_BASE + 0x2400)
#define SSUSB_USB2_CSR_BASE (U3D_BASE + 0x3400)

#define SSUSB_SIFSLV_IPPC_BASE (USB_SIF_BASE + 0x700) /* FIXME do not list in MT6752 memory map*/

#define SSUSB_SIFSLV_SPLLC_BASE (USB_SIF2_BASE + 0x000)           /* FIXME do not list in MT6752 memory map*/
#define SSUSB_SIFSLV_U2PHY_COM_BASE (USB_SIF2_BASE + 0x800)       /* FIXME do not list in MT6752 memory map*/
#define SSUSB_SIFSLV_U3PHYD_BASE (USB_SIF2_BASE + 0x900)          /* FIXME do not list in MT6752 memory map*/
#define SSUSB_SIFSLV_U2PHY_COM_SIV_B_BASE (USB_SIF2_BASE + 0x800) /* FIXME do not list in MT6752 memory map*/
#define SSUSB_USB30_PHYA_SIV_B_BASE (USB_SIF2_BASE + 0xB00)       /* FIXME do not list in MT6752 memory map*/
#define SSUSB_SIFSLV_U3PHYA_DA_BASE (USB_SIF2_BASE + 0xC00)       /* FIXME do not list in MT6752 memory map*/

#define GPT_BASE (IO_PHYS + 0x8000)

#define MSDC0_BASE (IO_PHYS + 0x1230000)
#define MSDC1_BASE (IO_PHYS + 0x1240000)
#define MSDC2_BASE (IO_PHYS + 0x1250000)

#define HACC_BASE (IO_PHYS + 0xA000)

#define MCUCFG_BASE (IO_PHYS + 0x200000)
